<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
    <table style="border-collapse:collapse;border:1px solid black;width:100%;text-align:center;">
      <tr style="background-color:blue;color:white;width:100%;">
      	<td style="text-align:center;width:10%;"><b>time \ day</b></td>
        <td style="text-align:center;width:12%;"><b>Sunday</b></td>
        <td style="text-align:center;width:12%;"><b>Monday</b></td>
        <td style="text-align:center;width:12%;"><b>Tuesday</b></td>
        <td style="text-align:center;width:12%;"><b>Wednesday</b></td>
        <td style="text-align:center;width:12%;"><b>Thursday</b></td>
        <td style="text-align:center;width:12%;"><b>Friday</b></td>
        <td style="text-align:center;width:12%;"><b>Saturday</b></td>
      </tr>
      <xsl:for-each select="/timetable/table/line">
      <tr>
      	 <td style="border:1px solid black;background-color:blue;vertical-align:middle;color:white;text-align:center;">
      	 	<b><xsl:value-of select="time"/></b>
      	 </td>
      	 <xsl:for-each select="cell">
      	 <xsl:choose>
		    <xsl:when test="duration &lt; 1">
		    <td style="border:1px solid black;vertical-align:middle;text-align:center;"></td>
		    </xsl:when>
		    <xsl:otherwise>
	        	<td rowspan="{./duration}" style="color:black;background-color:{./color};border:1px solid black;vertical-align:middle;text-align:center;">
	        			<a href="#" style="color:black" onclick="loadPage('shared/viewCourse.jsp?courseId={./courseid}');">
	        				<b><xsl:value-of select="courseName"/></b></a><br></br>     		
	        			<xsl:value-of select="room"/><br></br>
	        			<xsl:value-of select="type"/>
	        	</td>
        	</xsl:otherwise>
        	</xsl:choose>
         </xsl:for-each>
      </tr>
      </xsl:for-each>
    </table>
    <a href="#" onclick="loadPage('student/timetable.jsp?num=2');"> clean view </a>
	</xsl:template>
</xsl:stylesheet>